Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Windows.Forms

Public Class FrmCrDuTruMuaSanPham
    Private data As DataTable
    Private thang, nam, kho, ten_ncc As String
    Private tiendauky As Double
    Private ngaythangnam As Date
    Private customerReport As ReportDocument

    Delegate Sub WaitDelegate()

    Private Sub FrmCrDuTruMuaSanPham_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        globalVariale.runWaitting = True
        Dim wd As New WaitDelegate(AddressOf moduleWaitting.runningWait)
        wd.BeginInvoke(Nothing, Nothing)

        Dim sqlQuery As String = ""
        sqlQuery = "SELECT * FROM tbl_temp_dutru_muasanpham"
        Dim reportPath = Application.StartupPath & "\" & "CrDuTru_Mua_SanPham.rpt"
        customerReport = New ReportDocument()
        customerReport.Load(reportPath)
        customerReport.SetDataSource(moduleReportConfig.GetDataTable(sqlQuery))
        'customerReport.SetParameterValue("month", thang)
        'customerReport.SetParameterValue("year", nam)
        'customerReport.SetParameterValue("TKho", kho)

        customerReport.SetParameterValue("company", globalVariale.COMPANY)
        customerReport.SetParameterValue("address", globalVariale.ADDRESS)
        customerReport.SetParameterValue("ten_ncc", ten_ncc)
        customerReport.SetParameterValue("ngaychungtu", ngaythangnam)
        'customerReport.SetParameterValue("masothue", globalVariale.MASOTHUE)
        'customerReport.SetParameterValue("ketoantruong", globalVariale.KETOANTRUONG)
        'customerReport.SetParameterValue("giamdoc", globalVariale.TONGGIAMDOC)

        Me.CrNXTTongHopview.ReportSource = customerReport

        globalVariale.runWaitting = False
    End Sub


    Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Close()
    End Sub

    Public Sub setNgayThangNam(ByVal d As Date)
        ngaythangnam = d
    End Sub
    Public Sub setThang(ByVal s As String)
        thang = s
    End Sub
    Public Sub setTen_ncc(ByVal s As String)
        ten_ncc = s
    End Sub

    Public Sub setNam(ByVal s As String)
        nam = s
    End Sub
    Public Sub setKho(ByVal s As String)
        kho = s
    End Sub

    Public Sub setData(ByVal d As DataTable)
        data = d
    End Sub


End Class
